<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@page import="com.is.util.*" %>
<%@page import="com.is.control.*" %>
<%@page import="com.is.model.*" %>
<%@page import="java.util.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<% 
	request.setCharacterEncoding("UTF-8");
	int uid = ParamUtil.getInt(request,"id");
	session.getAttribute("role");
	int classId = -1;
	List<CourseClass> list1 = new ArrayList<CourseClass>();
	List<Student> list2 = new ArrayList<Student>();
	list1 = CourseClassControl.getAllCourseClassIdByUidAndStuyear(uid,ParamStuyearControl.getCurrentStuyearId());
	System.out.println(list1.size());
	if(list1.size()>1){
%>
<p>请选择班级：</p>
<form name='class' action='students_all.jsp' method='post' >
<%
		classId = ParamUtil.getInt(request,"classId");
		for(int i=0;i<list1.size();i++){
			int temId = list1.get(i).getClassId();
		
%>
<%=ParamClassControl.getClassName(temId) %>:
<input name='classId' type="radio" onchange="javascript:document.forms['class'].submit();" value="<%=temId %>" <% out.print((temId==classId)?"checked":""); %>/>
<%	
		}
	} else if(list1.size() == 1){
		classId = list1.get(0).getClassId();
	}
	if(classId != -1 ){
%>
</form>
<table>
<thead>
	<tr>
		<th>中文姓名</th>
		<th>英文姓名</th>
		<th>班级</th>
		<th>操作</th>
	</tr>
</thead>
<%
		list2 = StudentControl.getStudentByClassId(classId + "");
		for(int i = 0;i<list2.size();i++){
			int sid = list2.get(i).getId();
			Student s = new Student();
			s = StudentControl.getStudent(sid);
%>
<tbody>
	<tr>
		<td><%=s.getChineseName() %></td>
		<td><%=s.getPassportName() %></td>
		<td><%=ParamClassControl.getClassName(Integer.parseInt(s.getClassId())) %></td>
		<td><a href="student_update?sid=<%=sid %>">修改</a></td>
	</tr>
</tbody>
</table>
<%
		}
	}
%>
</body>
</html>